package com.ezops.dao.facade;

import java.io.Serializable;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ezops.dao.SystemPropertyDAOImpl;
import com.ezops.dao.generics.dao.hibernate.GenericDAO;
import com.ezops.models.SystemProperty;


/***
 * Accounts DataTransfer Facade , handles all general accounts object cache access operations
 * @author HindsC
 *
 */
@Service
public class SystemPropertyDataTransferFacade extends DataTransferFacadeImpl<SystemProperty> implements ISystemPropertyFacade {

	final static Logger logger = LoggerFactory.getLogger(SystemPropertyDataTransferFacade.class);

	@Autowired
	private SystemPropertyDAOImpl dao;

	@Override
	public GenericDAO<SystemProperty, Serializable> getDataAccessObject() {
		// TODO Auto-generated method stub
		return dao;
	}

	@Override
	public SystemProperty getPropertyValue(SystemProperty porpertyKey) {
		return dao.find(porpertyKey.getId());
	}

	@Override
	@Transactional
	public void updateEodReportTime(SystemProperty property) {
		SystemProperty oldProperty = dao.find(property.getId());
		oldProperty.setValue(property.getValue());
		dao.save(oldProperty);
	}
	
	
	
}
